

from alipay import AliPay

from . import settings

alipay = AliPay(
    appid=settings.APP_ID,
    app_notify_url=None,  # 默认回调 url
    app_private_key_string=settings.APP_PRIVATE_KEY_STRING,
    # 支付宝的公钥，验证支付宝回传消息使用，不是你自己的公钥,
    alipay_public_key_string=settings.ALIPAY_PUBLIC_KEY_STRING,
    sign_type=settings.SIGN,  # RSA 或者 RSA2
    debug=settings.DEBUG,  # 默认 False
)





# # 电脑网站支付，需要跳转到：https://openapi.alipay.com/gateway.do? + order_string
# res=alipay.api_alipay_trade_page_pay(
#     out_trade_no='xsses883112',
#     total_amount=float(999),  # 只有生成支付宝链接时，不能用Decimal
#     subject='充气球',
#     return_url='http://127.0.0.1:8000',
#     notify_url='http://127.0.0.1:8000',
# )
#
# gataway = 'https://openapi.alipaydev.com/gateway.do?'
# print(gataway+res)
